
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllMedicineStorageDetails", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail"),
		@NamedQuery(name = "findMedicineStorageDetailById", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.id = ?1"),
		@NamedQuery(name = "findMedicineStorageDetailByIsPutaway", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.isPutaway = ?1"),
		@NamedQuery(name = "findMedicineStorageDetailByIsUseout", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.isUseout = ?1"),
		@NamedQuery(name = "findMedicineStorageDetailByPrimaryKey", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.id = ?1"),
		@NamedQuery(name = "findMedicineStorageDetailByTraceCode", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.traceCode = ?1"),
		@NamedQuery(name = "findMedicineStorageDetailByTraceCodeContaining", query = "select myMedicineStorageDetail from MedicineStorageDetail myMedicineStorageDetail where myMedicineStorageDetail.traceCode like ?1") })

@Table(catalog = "pig", name = "medicine_storage_detail")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "MedicineStorageDetail")

public class MedicineStorageDetail implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	 */

	@Column(name = "TraceCode", length = 24)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String traceCode;
	/**
	* �Ƿ��ϼܣ�Ĭ��ֵû���ϼܣ�Ϊ0
	* 
	 */

	@Column(name = "IsPutaway", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement 
	Integer isPutaway;
	/**
	* �Ƿ�ʹ����ϣ�Ĭ��ֵ��0����ʶû�����꣬������󴥷��޸�
	* 
	 */

	@Column(name = "IsUseout", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Integer isUseout;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "MedicineStorageId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	MedicineStorage medicineStorage;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "MedicineId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Medicine medicine;

	
	

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setTraceCode(String traceCode) {
		this.traceCode = traceCode;
	}

	/**
	 */
	public String getTraceCode() {
		return this.traceCode;
	}

	/**
	* �Ƿ��ϼܣ�Ĭ��ֵû���ϼܣ�Ϊ0
	* 
	 */
	public void setIsPutaway(Integer isPutaway) {
		this.isPutaway = isPutaway;
	}

	/**
	* �Ƿ��ϼܣ�Ĭ��ֵû���ϼܣ�Ϊ0
	* 
	 */
	public Integer getIsPutaway() {
		return this.isPutaway;
	}

	/**
	* �Ƿ�ʹ����ϣ�Ĭ��ֵ��0����ʶû�����꣬������󴥷��޸�
	* 
	 */
	public void setIsUseout(Integer isUseout) {
		this.isUseout = isUseout;
	}

	/**
	* �Ƿ�ʹ����ϣ�Ĭ��ֵ��0����ʶû�����꣬������󴥷��޸�
	* 
	 */
	public Integer getIsUseout() {
		return this.isUseout;
	}

	/**
	 */
	public void setMedicineStorage(MedicineStorage medicineStorage) {
		this.medicineStorage = medicineStorage;
	}

	/**
	 */
	@JsonIgnore
	public MedicineStorage getMedicineStorage() {
		return medicineStorage;
	}

	/**
	 */
	public void setMedicine(Medicine medicine) {
		this.medicine = medicine;
	}

	/**
	 */
	@JsonIgnore
	public Medicine getMedicine() {
		return medicine;
	}

	/**
	 */
	public MedicineStorageDetail() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(MedicineStorageDetail that) {
		setId(that.getId());
		setTraceCode(that.getTraceCode());
		setIsPutaway(that.getIsPutaway());
		setIsUseout(that.getIsUseout());
		setMedicineStorage(that.getMedicineStorage());
		setMedicine(that.getMedicine());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("traceCode=[").append(traceCode).append("] ");
		buffer.append("isPutaway=[").append(isPutaway).append("] ");
		buffer.append("isUseout=[").append(isUseout).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof MedicineStorageDetail))
			return false;
		MedicineStorageDetail equalCheck = (MedicineStorageDetail) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
